package com.cakeclient;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
import com.cakeclient.Model.Store;


public class ClientWelcomeFragment extends SherlockFragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.client_welcome_layout,container,false);

    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);    //To change body of overridden methods use File | Settings | File Templates.
        Store localStore = Store.getLocalStore(getSherlockActivity().getBaseContext());
        if (localStore != null){
            LinearLayout layout = (LinearLayout) getSherlockActivity().findViewById(R.id.client_welcome_localstorename_layout);
            TextView textViewName = (TextView) getSherlockActivity().findViewById(R.id.client_welcome_store_name);
            textViewName.setText(textViewName.getText() + " " + localStore.getName());
            TextView textViewaddress = (TextView) getSherlockActivity().findViewById(R.id.client_welcome_store_address);
            textViewaddress.setText(textViewaddress.getText() + " " + localStore.getPlace().getAddress().toString());
            layout.setVisibility(View.VISIBLE);
        }
    }
}
